package com.moeciyo.android.moeciyo.fragment;

import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import com.moeciyo.android.moeciyo.R;
import com.moeciyo.android.moeciyo.mvp.adapter.HomeAdapter;
import com.moeciyo.android.moeciyo.mvp.base.BasePagerFragment;
import com.moeciyo.android.moeciyo.mvp.model.HomeCategoryModel;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import cn.droidlover.xdroidmvp.base.SimpleRecAdapter;
import cn.droidlover.xrecyclerview.RecyclerItemCallback;
import cn.droidlover.xrecyclerview.XRecyclerView;

public class RecommendFragment extends BasePagerFragment{

    HomeAdapter adapter;

    @Override
    public SimpleRecAdapter getAdapter() {
        if (adapter == null) {
            adapter = new HomeAdapter(context);
            adapter.setRecItemClick(new RecyclerItemCallback<HomeCategoryModel.Item, HomeAdapter.ViewHolder>() {
                @Override
                public void onItemClick(int position, HomeCategoryModel.Item model, int tag, HomeAdapter.ViewHolder holder) {
                    super.onItemClick(position, model, tag, holder);
                    switch (tag) {
                        case HomeAdapter.TAG_VIEW:
                            Log.d("进来了", "url:model");
                            break;
                    }
                }
            });
        }
        return adapter;
    }

    @Override
    public void setLayoutManager(XRecyclerView recyclerView) {
        recyclerView.verticalLayoutManager(context);
    }

    @Override
    public String getType() {
        return "all";
    }

    public static RecommendFragment newInstance() {
        return new RecommendFragment();
    }
}
